<?php

/**
 * Product form base class.
 *
 * @method Product getObject() Returns the current form's model object
 *
 * @package    EurekaManagerProject
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProductForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'clientcharge_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'), 'add_empty' => false)),
      'agentcharge_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'), 'add_empty' => false)),
      'blogger_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Blogger'), 'add_empty' => false)),
      'user_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'product'         => new sfWidgetFormInputText(),
      'startdate'       => new sfWidgetFormInputText(),
      'enddate'         => new sfWidgetFormInputText(),
      'pledgetime'      => new sfWidgetFormInputText(),
      'sale'            => new sfWidgetFormInputText(),
      'cost'            => new sfWidgetFormInputText(),
      'deadline'        => new sfWidgetFormInputText(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'clientcharge_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'))),
      'agentcharge_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'))),
      'blogger_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Blogger'))),
      'user_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'product'         => new sfValidatorString(array('max_length' => 255)),
      'startdate'       => new sfValidatorPass(),
      'enddate'         => new sfValidatorPass(),
      'pledgetime'      => new sfValidatorInteger(array('required' => false)),
      'sale'            => new sfValidatorInteger(),
      'cost'            => new sfValidatorInteger(),
      'deadline'        => new sfValidatorPass(),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('product[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Product';
  }

}
